<template>
	<div class="topbar">
		<van-nav-bar
			left-arrow
			fixed
		  title="购物袋"
		  left-text="返回"
		  :right-text="isEdit ? '完成' : '编辑'"
			@click-left="$router.back(-1)"
			@click-right="handelRight"
		/>
	</div>
</template>

<script>
	import bus from '@/utils/eventBus.js'
	export default {
		data () {
			return {
				// 是否编辑
				isEdit: false
			}
		},
		methods: {
			handelRight () {
				this.isEdit = !this.isEdit
				bus.$emit('isEdit', this.isEdit)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.topbar{
		height: 46px;
	}
</style>